﻿using SwyishChess.Domain.Piece;

namespace SwyishChess.Domain.Move
{
    public class SpecialChessMove : ChessMove
    {
        /// <summary>
        /// Indicates which special move it is
        /// </summary>
        public SpecialMove SpecialMoveType { get; set; }
        /// <summary>
        /// Keeps track of affected chess piece by the special move
        /// </summary>
        public ChessPiece AffectedChessPiece { get; set; }

        /// <summary>
        /// Overloaded constructor
        /// </summary>
        /// <param name="cp">Chess Piece object</param>
        /// <param name="currentRow">Row location moving from</param>
        /// <param name="currentColumn">Column location moving from</param>
        /// <param name="newRow">New row location</param>
        /// <param name="newColumn">New column location</param>
        /// <param name="capturedPiece">Captured piece</param>
        /// <param name="specialMoveType">String value that defines what type of special move it is</param>
        public SpecialChessMove(ChessPiece cp, int currentRow, int currentColumn, int newRow, int newColumn,
            ChessPiece capturedPiece, SpecialMove specialMoveType)
            : base(cp, currentRow, currentColumn, newRow, newColumn, capturedPiece)
        {
            switch (specialMoveType)
            {
                case SpecialMove.EnPassant:
                    SpecialMoveType = SpecialMove.EnPassant;
                    break;
                case SpecialMove.Castling:
                    SpecialMoveType = SpecialMove.Castling;
                    break;
                case SpecialMove.Promotion:
                    SpecialMoveType = SpecialMove.Promotion;
                    break;
            }
        }

        /// <summary>
        /// Overriden to string method
        /// </summary>
        /// <returns>Call super class'es to string methods and add special move detail</returns>
        public override string ToString()
        {
            return base.ToString() + " " + SpecialMoveType.ToString();
        }
    }
}
